package com.huayun.code.core.extractor;

import java.math.BigDecimal;
import java.sql.Time;
import java.util.Date;

public class JavaType {
    public static Class<?> jdbcType2JavaType(JdbcType jdbcType) {
        switch (jdbcType) {
            case BIT:
            case BOOLEAN:
                return Boolean.class;
            case CHAR:
            case NCHAR:
            case VARCHAR:
            case NVARCHAR:
            case LONGVARCHAR:
            case CLOB:
            case NCLOB:
                return String.class;
            case TINYINT:
            case SMALLINT:
            case INTEGER:
                return Integer.class;
            case FLOAT:
                return Float.class;
            case DOUBLE:
                return Double.class;
            case BIGINT:
                return Long.class;
            case REAL:
            case NUMERIC:
            case DECIMAL:
                return BigDecimal.class;
            case TIMESTAMP:
            case DATE:
                return Date.class;
            case TIME:
                return Time.class;
//            case TIMESTAMP:
//                return Timestamp.class;
            case BINARY:
            case VARBINARY:
            case LONGVARBINARY:
            case BLOB:
                return byte[].class;
            default:
                return null;
        }
    }
}
